package com.kj.report.rest;

import com.kj.common.exception.RestException;
import com.kj.common.response.Response;
import com.kj.common.response.ResponseCode;
import com.kj.report.service.ReportV3Service;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * v3报告生成
 */
@RestController
@RequestMapping("report/reportV3")
public class ReportV3Rest {


    @Resource
    private ReportV3Service reportV3Service;

    @PostMapping("/reportGeneration")
    public Response<Object> reportGeneration(@RequestParam String reportId,@RequestParam Long userId){

        if (StringUtils.isBlank(reportId)){
            throw new RestException(ResponseCode.ILLEGAL_PARAM.getCode(),"报告Id 不能为空");
        }
        if (userId == null){
            throw new RestException(ResponseCode.ILLEGAL_PARAM.getCode(),"用户Id 不能为空");
        }

        Response<String>  result=this.reportV3Service.reportGeneration(reportId,userId);

        return null;
    }

}
